#ifndef __TASK_LIST_H__
#define __TASK_LIST_H__

#include "mutex_lock.hpp"
#include "condition.hpp"
#include <queue>
#include <pthread.h>
#include <functional>

using std::queue;
namespace rocket 
{
class task;

using elemtype2 = std::function<void()>;

class task_list
{
public:
    task_list(int);
    ~task_list(){}
    void push(elemtype2);
    elemtype2 pop();
    bool full();
    bool empty();
    void notify_all();
    
private:
    queue<elemtype2> _to_do_list;
    int _capacity;
    mutex_lock _lock;
    condition _waiting_to_push;
    condition _waiting_to_pop;
    bool _no_need_to_wait;
};

}

#endif